<TMPL_INCLUDE name="./header.html">

<table border=0 width=100% height=470>
<tr>
	<TD width=25% style="border-right:1px solid lightgrey;margin-left:0em;">
		<table width=100% border=0 cellpadding="0" cellspacing="0">
			<TR>
			<TD><h3 style="border-right:0px solid lightgrey;margin-left:0.2em;">Newsletters</h3></TD>
			<TD style="text-align:right; font-size:10px;">
				<a onclick="RefreshContentList(1);">Active</a> | 
				<a onclick="RefreshContentList(0);">Inactive</a> | 
				<a onclick="RefreshContentList();">All</a><!-- | 
				<a onclick="RefreshContentList();">Refresh</a> <br>-->
				<div id=newsletter_list_status></div>
			</TD>
			</TR>
		</table>
		<TMPL_INCLUDE name=newsletters_list.html>
	</TD>
	<TD>
		<iframe src=editor.cgi width=100% height=593px frameborder=0 marginwidth="0" marginheight="0" name=editorframe id=editorframe></iframe>
	</TD>
</tr>
</table>

<TMPL_INCLUDE name="./footer.html">

<script>

function UpdateEditor(content_id) {
	document.getElementById('editorframe').src 	= "editor.cgi?content_id=" + content_id;
	return;
}

function SetContentActive(active_bit, content_id) {
	URL	= "<TMPL_VAR name=APP_PATH_CGI>/admin/newsletters.cgi";
	PARAMS	= "action=setactive&content_id=" + content_id + "&active=" + active_bit;
// 	alert(URL + "?" + PARAMS);
	new Ajax.Updater ('newsletter_list', URL, {
				parameters:PARAMS,
				onLoading:PrintStatus('newsletter_list_status', '<font color=red>Refreshing...</font>'),
				onComplete:ShowLoaded,
			});
}

function RefreshContentList(active)
{
	URL	= "<TMPL_VAR name=APP_PATH_CGI>/admin/newsletters.cgi";
	PARAMS	= "action=content_list&active=" + active;
// 	alert(URL + "?" + PARAMS);
	new Ajax.Updater ('newsletter_list', URL, {
				parameters:PARAMS,
				onLoading:PrintStatus('newsletter_list', 'Refreshing...'),
				// onComplete:PrintStatus('newsletter_list_status', '')
			});
}

function PreviewContent(content_id) {
	window.open('ContentViewer?content_id=' + content_id, '', 'width=800,height=600,resizable=1,');
}

function ShowLoaded() {
	$('newsletter_list_status').innerHTML = ''
}
</script>
